package lik.nio.file;

import java.io.FileInputStream;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
import java.nio.charset.Charset;

public class ReadFile {

	/**
	 * @param args
	 * @throws Exception
	 */
	public static void main(String[] args) throws Exception {
		
		FileChannel fChannel = new FileInputStream("c:\\RHDSetup.log").getChannel();
		ByteBuffer readBuffer = ByteBuffer.allocate(1024);

		while (fChannel.read(readBuffer) != -1) {
			readBuffer.flip();
			System.out.println(Charset.defaultCharset().decode(readBuffer).toString());
			readBuffer.clear();
		}
		//fChannel.write(ByteBuffer.wrap("lik1111111111111".getBytes()));
		fChannel.close();
	}

}
